package 集合;

import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @ClassName : HashMapText
 * @Author : LV88VL
 * @Date: 2021/3/12 9:43
 * @Description : HashMap接口========================同HashMap
 */
public class HashMapText {
    public static void main(String[] args) {
        //1.。创建hashmap集合对象
        Map<King,String> map =new HashMap<King,String>();
        //2.。添加元素
        map.put(new King("cixi",1000),"北京");
        map.put(new King("cixi",5000),"北京");
        map.put(new King("cixi",2000),"北京");
        map.put(new King("cixi",3000),"北京");
        //3.。取出元素
        for (King key:map.keySet()) {
            String value=map.get(key);
            System.out.println(key.toString()+".........."+value);
        }
    }
}
